import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yp/config/config.dart';
import 'package:yp/helper.dart';
import 'package:yp/widgets/button_widget.dart';
import 'package:yp/router.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'logic.dart';
import 'state.dart';
import 'widgets/text_input.dart';


class OrderDepositPage extends StatelessWidget {
  final OrderDepositLogic logic = Get.put(OrderDepositLogic());
  final OrderDepositState state = Get.find<OrderDepositLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      appBar: AppBar(
        backgroundColor: Config.mainColor,
        brightness: Brightness.light,
        iconTheme: IconThemeData(color: Colors.white),
        title: Text(
          "定金金额维护",
          style: TextStyle(color: Colors.white, fontSize: 32.sp),
        ),
        centerTitle: true,
        elevation: 0,
      ),
      body: Column(
        children: [
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                // 订单总额
                TextInputWidget(
                  title: "订单总额",
                  enable: false,
                  hintText: "5399",
                  controller: state.controller1,
                ),
                // 订金金额
                TextInputWidget(
                  title: "订金金额",
                  hintText: "请填写",
                  controller: state.controller2,
                ),
                // 用户手机号
                TextInputWidget(
                  title: "尾款金额",
                  hintText: "请输入",
                  controller: state.controller3,
                ),
                // 尾款预计付款日期
                TextInputWidget(
                  title: "尾款预计付款日期",
                  suffixWidget: GestureDetector(
                    onTap: () {
                      toast("select");
                    },
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        Text(
                          "请选择",
                          style: TextStyle(
                            fontSize: 28.sp,
                            color: Color(0xffcccccc),
                          ),
                        ),
                        Icon(
                          Icons.arrow_forward_ios_rounded,
                          color: Color(0xffcccccc),
                          size: 14,
                        )
                      ],
                    ),
                  ),
                ),
              ],
            ),
          ),

          GestureDetector(
            onTap: () {
              Get.toNamed(RouteConfig.orderPayment);
            },
            child:Container(
              color: Colors.white,
              padding: EdgeInsets.symmetric(vertical: 30.w,horizontal:46.w,),
              child:Padding(
                padding: EdgeInsets.symmetric(
                  horizontal: 20.w,
                ),
                child: ButtonWidget(title: "完成"),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
